<template>
  <div class="volunteerList">
    <div class="volunteerList_header">
      <h2>我的志愿表</h2>
      <div class="new_list">
        <router-link to="/volunteer" tag="span">
          <el-button type="primary" icon="el-icon-plus">创建新的</el-button>
        </router-link>
      </div>
    </div>

    <div class="nullList" v-if="cententList.length == '0' ">
      <h4>暂无数据</h4>
      <el-button type="primary">
        <router-link to="/volunteer" tag="div">
          <i class="el-icon-plus"></i> 添加志愿
        </router-link>
      </el-button>
    </div>
    <div class="list_centent" v-else>
      <div class="centent" v-for="item in cententList" :key="item.id">
        <router-link
          :to="{
        name :'/VolunteerList/VolunteerDetails',
        params:{
          schoolId : item.id
        }      
       
        }"
          tag="div"
          class="Details_router"
        ></router-link>
        <h3>
          我的志愿表
          <span>{{item.volunteerName}}</span>
          <i class="el-icon-close" @click="cutMyVolunteer(item.id)"></i>
        </h3>
        <h4>
          <span class="tyle">
            #{{
            item.volunteerType == 4 ? "智能填报"
            :item.volunteerType == 3 ? "手动填报"
            :item.volunteerType == 2 ? "专业填报"
            :item.volunteerType == 1 ? "院校填报"
            :" "
            }}
          </span>
        </h4>
        <h4>
          <span class="item">{{item.createTime}}</span>
        </h4>
        <!-- <div class="data_list">
          <h4 class="success">合理</h4>
          <div class="progress">
            <el-progress
              type="circle"
              :percentage="95"
              status="success"
              :width="62"
              :stroke-width="2"
            ></el-progress>
          </div>

          <h5>编辑</h5>
        </div>-->
<<<<<<< HEAD
        <!-- <div class="data_list">
=======
        <div class="data_list">
>>>>>>> 314b442cce11d658746227581b0160373004c345
          <h4 class="success">合理</h4>
          <div class="progress">
            <el-progress
              type="circle"
              :percentage="95"
              status="success"
              :width="62"
              :stroke-width="2"
            ></el-progress>
          </div>
<<<<<<< HEAD
        </div>-->
=======

          <!-- <h5>编辑</h5> -->
        </div>
>>>>>>> 314b442cce11d658746227581b0160373004c345
      </div>
    </div>
    <div class="bottom" v-show="cententList.length > 0">
      <div v-if="totalCount+1 > pageSize" @click="addLists">点击获取更多</div>
      <div v-else>没有更多了</div>
    </div>
  </div>
</template>
<script>
export default {
  name: "VolunteerList",
  data() {
    return {
      cententList: [0],
      pageSize: 9,
      totalCount: ""
    };
  },
  methods: {
    getVolunteerList() {
      this.$ajax({
        method: "POST",
        url: "/api/volunteer/list/volunteer",
        data: {
          pageNow: 1,
          pageSize: this.pageSize
        },

        success: res => {
          if (res.data.code == 0) {
            this.cententList = res.data.data.list;
            this.totalCount = res.data.data.totalCount;
          }
        }
      });
    },
    addLists() {
      this.pageSize += 9;
      this.getVolunteerList();
    },
    cutMyVolunteer(ID) {
      this.$ajax({
        method: "GET",
        url: "/api/volunteer/delete/volunteer?id=" + ID,

        success: res => {
          if (res.data.code == 0) {
            this.getVolunteerList();
          }
        }
      });
    }
  },
  beforeCreate() {
    this.$nextTick(() => {
      this.getVolunteerList();
    });
  }
};
</script>
<style lang="scss">
.volunteerList {
  .bottom {
    div {
      width: 200px;
      height: 60px;
      margin: 0 auto;
      line-height: 60px;
      color: #a3a3a3;
      cursor: pointer;
    }
  }
}

.volunteerList_header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 72px;
  background: #ffffff;
  border-radius: 10px;
  h2 {
    padding-left: 72px;
  }
  .new_list {
    padding-right: 42px;
    .el-button {
      padding: 10px 20px;
    }
  }
}
.list_centent {
  display: flex;

  flex-wrap: wrap;
  .centent {
    box-sizing: border-box;
    position: relative;
    width: 284px;
    padding: 0 38px;
    height: 300px;
    background: #ffffff;
    border-radius: 10px;
    margin-top: 24px;
    margin-right: 34px;
    .Details_router {
      position: absolute;

      width: 226px;
      height: 286px;

      left: 0;
    }
    > h3 {
      position: relative;
      margin-top: 46px;
      font-size: 18px;
      display: flex;
      justify-content: space-between;

      span {
        display: block;

        width: 96px;
        height: 20px;
        overflow: hidden;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      i {
        position: absolute;
        color: #f14d62;
        display: block;
        padding: 10px;
        z-index: 20;
        right: -30px;
        top: -36px;
      }
    }
    > h4 {
      color: #a3a3a3;
      font-size: 12px;
      line-height: 26px;
    }

    .data_list {
      h4 {
        padding: 22px 0 16px 0;
        font-size: 12px;
      }
      .success {
        color: rgb(19, 206, 102);
      }
      .warning {
        color: rgb(230, 162, 60);
      }
      .exception {
        color: rgb(255, 73, 73);
      }
      h5 {
        font-size: 12px;
        color: #818181;
        padding-top: 22px;
        cursor: pointer;
      }
      .progress {
        i {
          font-size: 16px;
        }
      }
    }
  }
  .centent:nth-child(3n) {
    margin-right: 0;
  }
}
.nullList {
  margin: 100px auto;
  width: 128px;
  height: 100px;
  h4 {
    text-align: center;
    padding: 20px 0;
  }
}
</style>